import { IsString, IsNumber, IsEnum, IsOptional, MinLength, MaxLength, Matches } from 'class-validator';

export class UpdateUserDto {
  @IsOptional()
  @IsString()
  @MinLength(6)
  @MaxLength(20)
  password?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  nickname?: string;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  @Matches(/^1[3-9]\d{9}$/, { message: '手机号格式不正确' })
  phone?: string;

  @IsOptional()
  @IsNumber()
  points?: number;

  @IsOptional()
  @IsEnum(['正常', '禁用'], { message: '状态只能是 正常 或 禁用' })
  status?: string;

  @IsOptional()
  @IsString()
  remark?: string;
} 